package robot.arm;

import javax.media.j3d.Appearance;
import javax.media.j3d.ColoringAttributes;
import javax.media.j3d.Material;
import javax.media.j3d.TransformGroup;
import javax.vecmath.Color3f;
import javax.vecmath.Vector3f;

import com.sun.j3d.utils.geometry.*;

import com.sun.j3d.utils.universe.*;

import javax.media.j3d.*;

import javax.vecmath.*;

public class Base extends Link {
	
	private Cylinder baseAnchor;  // the Base requires two shapes, not just one
	private Vector3f anchorPosition;
	//private Vector3f trunkPosition;
	
	public Base(float height, Color3f initialColors) {
		// make the cylinder
		super(height, initialColors);
		
		Appearance initStuff = new Appearance();
		
	      ColoringAttributes prettyColors = new ColoringAttributes(initialColors, ColoringAttributes.NICEST);
	      
	      Material shiny = new Material();
	      
	      shiny.setAmbientColor(0.1f, 0.1f, 0f);
	      
	      shiny.setSpecularColor(0.1f, 0.1f, 0.1f);
	      
	      shiny.setDiffuseColor(1.0f, 1.0f, 0.0f);
	      
	      shiny.setShininess(0.05f);
		
		linkShape = new Cylinder(0.33f, 0.19f, Cylinder.ENABLE_APPEARANCE_MODIFY | Cylinder.GENERATE_NORMALS, 25, 25, initStuff);
		
		linkName = "base";
		
		position = new Vector3f(0.0f, 0.0f, 0.0f);
		
		// now position the Cylinders accordingly
	}
	
	public Base(float baseHeight) {
		// TODO Auto-generated method stub
		Appearance initStuff = new Appearance();
		
		Color3f initialColors = new Color3f(255.0f, 255.0f, 255.0f);
		
	      ColoringAttributes prettyColors = new ColoringAttributes(initialColors, ColoringAttributes.NICEST);
	      
	      Material shiny = new Material();
	      
	      shiny.setAmbientColor(0.1f, 0.1f, 0f);
	      
	      shiny.setSpecularColor(0.1f, 0.1f, 0.1f);
	      
	      shiny.setDiffuseColor(1.0f, 1.0f, 0.0f);
	      
	      shiny.setShininess(0.05f);
	      
	      initStuff.setColoringAttributes(prettyColors);
	      initStuff.setMaterial(shiny);
		
		linkShape = new Cylinder(0.33f, 0.19f, Cylinder.ENABLE_APPEARANCE_MODIFY | Cylinder.GENERATE_NORMALS, 25, 25, initStuff);
		
		linkName = "base";
		
		position = new Vector3f(0.0f, 0.0f, 0.0f);
	}

	public Base() {
		// TODO Auto-generated method stub
		Appearance initStuff = new Appearance();
		
		Color3f initialColors = new Color3f(255.0f, 255.0f, 255.0f);
		
	      ColoringAttributes prettyColors = new ColoringAttributes(initialColors, ColoringAttributes.NICEST);
	      
	      Material shiny = new Material();
	      
	      shiny.setAmbientColor(0.1f, 0.1f, 0f);
	      
	      shiny.setSpecularColor(0.1f, 0.1f, 0.1f);
	      
	      shiny.setDiffuseColor(1.0f, 1.0f, 0.0f);
	      
	      shiny.setShininess(0.05f);
	      
	      initStuff.setColoringAttributes(prettyColors);
	      initStuff.setMaterial(shiny);
		
		linkShape = new Cylinder(0.33f, 0.19f, Cylinder.ENABLE_APPEARANCE_MODIFY | Cylinder.GENERATE_NORMALS, 25, 25, initStuff);
		
		linkName = "base";
		
		position = new Vector3f(0.0f, 0.0f, 0.0f);
	}

	@Override
	public void moveLink(Vector3f direction) {
		// TODO Auto-generated method stub
		
	}

	@Override
	public void moveLink() {
		// TODO Auto-generated method stub
		
	}

	@Override
	public Vector3f getPosition() {
		// TODO Auto-generated method stub
		return position;
	}
	
	public Vector3f getBasePosition() {
		return anchorPosition;
	}

	@Override
	public Cylinder getShape() {
		// TODO Auto-generated method stub
		return linkShape;
	}
	
	public Cylinder getAnchor() {
		return baseAnchor;
	}
	
}
